﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _11_接口的特点2
{
    class Program
    {
        static void Main(string[] args)
        {
            //麻雀、鹦鹉、直升飞机会飞，鸵鸟、企鹅不会飞
            //用多态来实现：虚方法、抽象类、接口
            IFlyable fly = new YingWu();
            fly.Fly();
            Console.ReadKey();

        }
    }

    public class Bird
    {
        public double Wings
        {
            get;
            set;
        }

        public void EatAndDrink()
        {
            Console.WriteLine("吃吃喝喝");
        }
    }

    public class MaQue : Bird, IFlyable
    {
        public void Fly()
        {
            Console.WriteLine("麻雀飞了");
        }
    }

    public class YingWu : Bird, IFlyable, ISpeak
    {
        public void Fly()
        {
            Console.WriteLine("鹦鹉飞了");
        }

        public void Speak()
        {
            Console.WriteLine("鹦鹉开口说话了");
        }
    }

    public class TuoBird : Bird
    {

    }

    public class QQ : Bird
    {

    }

    public class Plane : IFlyable
    {
        public void Fly()
        {
            Console.WriteLine("直升飞机即刻起飞");
        }
    }

    public interface IFlyable
    {
        void Fly();
    }

    public interface ISpeak
    {
        void Speak();
    }
}
